package cn.virens.oauth.subject;

import cn.virens.common.exception.APIException;
import cn.virens.oauth.request.principal.DelegatePrincipal;
import cn.virens.oauth.request.principal.DelegatePrincipalReadonly;

import java.io.Serializable;

@SuppressWarnings("serial")
public class SubjectNull extends DelegatePrincipalReadonly implements Subject, Serializable {
    private static final DelegatePrincipal EMPTY = new DelegatePrincipal();

    @Override
    public boolean hasPermissions(String... permissions) throws APIException {
        return false;
    }

    @Override
    public boolean hasRoles(String... roleIdentifiers) throws APIException {
        return false;
    }

    @Override
    public DelegatePrincipal logout() throws APIException {
        return null;
    }

    @Override
    public DelegatePrincipal delegate() throws APIException {
        return EMPTY;
    }

}
